package demo;
//线程池的一种写法
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Test14 {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newCachedThreadPool();
        for (int i = 0; i < 1000; i++) {
            int id = i;
            executorService.submit(()->{
                System.out.println("id:" + id + "," + Thread.currentThread().getName());

            });

        }
    }
}

